package bean;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * Author:shixiaojun@itany.com
 * Date:2022/3/8 16:49
 * Version:1.0-SNAPSHOT
 */
// 当注解中传递参数时,表示为当前的bean自定义一个id属性值
@Component("ob")
public class OtherBean {

//    @Value("1")
//    private Integer id;
//    @Value("李白")
//    private String name;

//    private Integer id = 2;
//    private String name = "张飞";

    @Value("${otherBean.id}")
    private Integer id;
    @Value("${otherBean.name}")
    private String name;

    @Override
    public String toString() {
        return "OtherBean{" +
                "id=" + id +
                ", name='" + name + '\'' +
                '}';
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}
